home *** CD-ROM | disk | FTP | other *** search
- package javax.management;
-
- import com.sun.jmx.defaults.ServiceName;
- import java.net.InetAddress;
- import java.net.UnknownHostException;
-
- public class MBeanServerDelegate implements MBeanServerDelegateMBean, NotificationEmitter {
- private String mbeanServerId;
- private final NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
- private static long oldStamp = 0L;
- private final long stamp = getStamp();
- private long sequenceNumber = 1L;
- private static final MBeanNotificationInfo[] notifsInfo;
- public static final ObjectName DELEGATE_NAME;
-
- public synchronized String getMBeanServerId() {
- if (this.mbeanServerId == null) {
- String var1;
- try {
- var1 = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException var3) {
- var1 = "localhost";
- }
-
- this.mbeanServerId = new String(var1 + "_" + this.stamp);
- }
-
- return this.mbeanServerId;
- }
-
- public String getSpecificationName() {
- return "Java Management Extensions";
- }
-
- public String getSpecificationVersion() {
- return "1.4";
- }
-
- public String getSpecificationVendor() {
- return "Sun Microsystems";
- }
-
- public String getImplementationName() {
- return "JMX";
- }
-
- public String getImplementationVersion() {
- return ServiceName.JMX_IMPL_VERSION;
- }
-
- public String getImplementationVendor() {
- return "Sun Microsystems";
- }
-
- public MBeanNotificationInfo[] getNotificationInfo() {
- int var1 = notifsInfo.length;
- MBeanNotificationInfo[] var2 = new MBeanNotificationInfo[var1];
- System.arraycopy(notifsInfo, 0, var2, 0, var1);
- return var2;
- }
-
- public synchronized void addNotificationListener(NotificationListener var1, NotificationFilter var2, Object var3) throws IllegalArgumentException {
- this.broadcaster.addNotificationListener(var1, var2, var3);
- }
-
- public synchronized void removeNotificationListener(NotificationListener var1, NotificationFilter var2, Object var3) throws ListenerNotFoundException {
- this.broadcaster.removeNotificationListener(var1, var2, var3);
- }
-
- public synchronized void removeNotificationListener(NotificationListener var1) throws ListenerNotFoundException {
- this.broadcaster.removeNotificationListener(var1);
- }
-
- public void sendNotification(Notification var1) {
- if (var1.getSequenceNumber() < 1L) {
- synchronized(this) {
- var1.setSequenceNumber((long)(this.sequenceNumber++));
- }
- }
-
- this.broadcaster.sendNotification(var1);
- }
-
- private static synchronized long getStamp() {
- long var0 = System.currentTimeMillis();
- if (oldStamp >= var0) {
- var0 = oldStamp + 1L;
- }
-
- oldStamp = var0;
- return var0;
- }
-
- static {
- String[] var0 = new String[]{"JMX.mbean.unregistered", "JMX.mbean.registered"};
- notifsInfo = new MBeanNotificationInfo[1];
- notifsInfo[0] = new MBeanNotificationInfo(var0, "javax.management.MBeanServerNotification", "Notifications sent by the MBeanServerDelegate MBean");
-
- try {
- DELEGATE_NAME = new ObjectName("JMImplementation:type=MBeanServerDelegate");
- } catch (MalformedObjectNameException var1) {
- throw new Error("Can't initialize delegate name", var1);
- }
- }
- }
-